home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / desktop / digclk12.zip / DIGCLOCK.FRM < prev    next >
Text File  |  1994-09-27  |  9KB  |  298 lines

  1. VERSION 2.00
  2. Begin Form frmClock 
  3.    BorderStyle     =   1  'Fixed Single
  4.    ClientHeight    =   735
  5.    ClientLeft      =   3240
  6.    ClientTop       =   855
  7.    ClientWidth     =   2730
  8.    ControlBox      =   0   'False
  9.    ForeColor       =   &H00FF0000&
  10.    Height          =   1170
  11.    Icon            =   DIGCLOCK.FRX:0000
  12.    Left            =   3165
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    Picture         =   DIGCLOCK.FRX:0302
  17.    ScaleHeight     =   735
  18.    ScaleWidth      =   2730
  19.    Top             =   495
  20.    Width           =   2880
  21.    Begin PictureClip picNumbers 
  22.       Cols            =   13
  23.       Location        =   "3705,525,1170,-60"
  24.       Picture         =   DIGCLOCK.FRX:0520
  25.    End
  26.    Begin SSPanel pnlClock 
  27.       BevelInner      =   1  'Inset
  28.       BevelWidth      =   2
  29.       Height          =   735
  30.       Left            =   0
  31.       TabIndex        =   0
  32.       Top             =   0
  33.       Width           =   2730
  34.       Begin PictureBox picClock 
  35.          BackColor       =   &H00000000&
  36.          BorderStyle     =   0  'None
  37.          Height          =   525
  38.          Left            =   105
  39.          ScaleHeight     =   525
  40.          ScaleWidth      =   2505
  41.          TabIndex        =   1
  42.          Top             =   105
  43.          Width           =   2505
  44.          Begin Image imgNum 
  45.             Height          =   525
  46.             Index           =   7
  47.             Left            =   2205
  48.             Top             =   0
  49.             Width           =   285
  50.          End
  51.          Begin Image imgNum 
  52.             Height          =   525
  53.             Index           =   6
  54.             Left            =   1890
  55.             Top             =   0
  56.             Width           =   285
  57.          End
  58.          Begin Image imgNum 
  59.             Height          =   525
  60.             Index           =   5
  61.             Left            =   1575
  62.             Top             =   0
  63.             Width           =   285
  64.          End
  65.          Begin Image imgNum 
  66.             Height          =   525
  67.             Index           =   0
  68.             Left            =   0
  69.             Top             =   0
  70.             Width           =   285
  71.          End
  72.          Begin Image imgNum 
  73.             Height          =   525
  74.             Index           =   1
  75.             Left            =   315
  76.             Top             =   0
  77.             Width           =   285
  78.          End
  79.          Begin Image imgNum 
  80.             Height          =   525
  81.             Index           =   2
  82.             Left            =   630
  83.             Top             =   0
  84.             Width           =   285
  85.          End
  86.          Begin Image imgNum 
  87.             Height          =   525
  88.             Index           =   3
  89.             Left            =   945
  90.             Top             =   0
  91.             Width           =   285
  92.          End
  93.          Begin Image imgNum 
  94.             Height          =   525
  95.             Index           =   4
  96.             Left            =   1260
  97.             Top             =   0
  98.             Width           =   285
  99.          End
  100.       End
  101.    End
  102.    Begin Timer Timer1 
  103.       Interval        =   1000
  104.       Left            =   3120
  105.       Top             =   1680
  106.    End
  107.    Begin Image imgGreen 
  108.       Height          =   525
  109.       Left            =   0
  110.       Picture         =   DIGCLOCK.FRX:168E
  111.       Top             =   1920
  112.       Width           =   3705
  113.    End
  114.    Begin Image imgRed 
  115.       Height          =   525
  116.       Left            =   0
  117.       Picture         =   DIGCLOCK.FRX:27FC
  118.       Top             =   2400
  119.       Width           =   3705
  120.    End
  121. End
  122. Option Explicit
  123.  
  124. Sub cmdEnd_Click ()
  125.  
  126. End Sub
  127.  
  128. Sub Form_Load ()
  129. Dim Success%
  130. Dim Temp
  131. Dim ReturnString As String
  132. Dim ReturnSize As Integer
  133. Dim CurrentPath As String
  134. Dim TempString As String
  135.  
  136.  
  137.  
  138. ReturnString = Space$(128)
  139. ReturnSize = Len(ReturnString)
  140. Temp = GetPrivateProfileString("DigClock", "Left", "0", ReturnString, ReturnSize, "digclock.ini")
  141. ReturnString = Left(ReturnString, Temp)
  142. Me.Left = Val(ReturnString)
  143. ReturnString = Space$(128)
  144. Temp = GetPrivateProfileString("DigClock", "Top", "0", ReturnString, ReturnSize, "digclock.ini")
  145. ReturnString = Left(ReturnString, Temp)
  146. Me.Top = Val(ReturnString)
  147. ReturnString = Space$(128)
  148. Temp = GetPrivateProfileString("DigClock", "Color", "0", ReturnString, ReturnSize, "digclock.ini")
  149. ReturnString = Left(ReturnString, Temp)
  150. If Val(ReturnString) = 0 Then
  151.    picNumbers.Picture = imgRed.Picture
  152.    ClockColor = 0
  153. Else
  154.    picNumbers.Picture = imgGreen.Picture
  155.    ClockColor = 1
  156. End If
  157. ReturnString = Space$(128)
  158. Temp = GetPrivateProfileString("DigClock", "TimeFormat", "12", ReturnString, ReturnSize, "digclock.ini")
  159. ReturnString = Left(ReturnString, Temp)
  160. If Val(ReturnString) = 12 Then
  161.    TimeFormat = 12
  162. Else
  163.    TimeFormat = 24
  164. End If
  165.  
  166. ReturnString = Space$(128)
  167. Temp = GetPrivateProfileString("DigClock", "OnTop", "0", ReturnString, ReturnSize, "digclock.ini")
  168. ReturnString = Left(ReturnString, Temp)
  169. If Val(ReturnString) = 1 Then
  170.    Success% = SetWindowPos(frmClock.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
  171.    OnTop = 1
  172. Else
  173.    Success% = SetWindowPos(frmClock.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
  174.    OnTop = 0
  175. End If
  176.  
  177. ReturnString = Space$(128)
  178. Temp = GetPrivateProfileString("DigClock", "SecondsOn", "0", ReturnString, ReturnSize, "digclock.ini")
  179. ReturnString = Left(ReturnString, Temp)
  180. If Val(ReturnString) = 1 Then
  181.    picClock.Width = 2500
  182.    pnlClock.Width = 2730
  183.    Me.Width = 2765
  184.    SecondsOn = 1
  185.    ' Turn on Colons
  186.    imgNum(2).Picture = picNumbers.GraphicCell(10)
  187.    imgNum(5).Picture = picNumbers.GraphicCell(10)
  188.  
  189. Else
  190.    picClock.Width = 1560
  191.    pnlClock.Width = 1770
  192.    Me.Width = 1800
  193.    SecondsOn = 0
  194. End If
  195. Load frmOptions
  196. End Sub
  197.  
  198. Sub Form_Unload (Cancel As Integer)
  199. Dim Temp
  200. Dim TempString As String
  201. TempString = Trim(Str(Me.Left))
  202. Temp = WritePrivateProfileString("DigClock", "Left", TempString, "digclock.ini")
  203. TempString = Trim(Str(Me.Top))
  204. Temp = WritePrivateProfileString("DigClock", "Top", TempString, "digclock.ini")
  205. TempString = Trim(Str(OnTop))
  206. Temp = WritePrivateProfileString("DigClock", "OnTop", TempString, "digclock.ini")
  207. TempString = Trim(Str(ClockColor))
  208. Temp = WritePrivateProfileString("DigClock", "Color", TempString, "digclock.ini")
  209. TempString = Trim(Str(TimeFormat))
  210. Temp = WritePrivateProfileString("DigClock", "TimeFormat", TempString, "digclock.ini")
  211. TempString = Trim(Str(SecondsOn))
  212. Temp = WritePrivateProfileString("DigClock", "SecondsOn", TempString, "digclock.ini")
  213.  
  214. End
  215. End Sub
  216.  
  217. Sub imgNum_MouseUp (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  218. Dim mpos As POINTAPI
  219. Dim p As ConvertPOINTAPI
  220. Dim ret As Integer
  221.  
  222. Call GetCursorPos(mpos) ' Get the current position of the cursor
  223. LSet p = mpos           ' and convert it for SendMessage calls.
  224.  
  225. ' Now tell the form someone is clicking the window caption:
  226. ret = Sendmessage(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, p.xy)
  227. End Sub
  228.  
  229. Sub Picture1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  230. Dim mpos As POINTAPI
  231. Dim p As ConvertPOINTAPI
  232. Dim ret As Integer
  233.  
  234. Call GetCursorPos(mpos) ' Get the current position of the cursor
  235. LSet p = mpos           ' and convert it for SendMessage calls.
  236.  
  237. ' Now tell the form someone is clicking the window caption:
  238. ret = Sendmessage(Me.hWnd, WM_SYSCOMMAND, MOUSE_MOVE, p.xy)
  239. End Sub
  240.  
  241. Sub pnlClock_DblClick ()
  242. frmOptions.Show
  243. End Sub
  244.  
  245. Sub pnlMenu_DblClick ()
  246. frmOptions.Show
  247. End Sub
  248.  
  249. Sub Timer1_Timer ()
  250. Dim Current
  251. Dim X As Integer
  252. If TimeFormat = 12 And SecondsOn = 0 Then
  253.    Current = Format(Now, "HH:MM AM/PM")
  254. End If
  255. If TimeFormat = 24 And SecondsOn = 0 Then
  256.    Current = Format(Now, "HH:MM")
  257. End If
  258.  
  259. If TimeFormat = 12 And SecondsOn = 1 Then
  260.    Current = Format(Now, "HH:MM:SS AM/PM")
  261. End If
  262. If TimeFormat = 24 And SecondsOn = 1 Then
  263.    Current = Format(Now, "HH:MM:SS")
  264. End If
  265.  
  266. If Current <> OldTime Then
  267.  
  268.    If Left(Current, 1) = "0" Then
  269.       imgNum(0).Picture = picNumbers.GraphicCell(12)
  270.    Else
  271.       imgNum(0).Picture = picNumbers.GraphicCell(Val(Left(Current, 1)))
  272.    End If
  273.    X = Val(Mid(Current, 2, 1))
  274.    imgNum(1).Picture = picNumbers.GraphicCell(X)
  275.    X = Val(Mid(Current, 4, 1))
  276.    imgNum(3).Picture = picNumbers.GraphicCell(X)
  277.    X = Val(Mid(Current, 5, 1))
  278.    imgNum(4).Picture = picNumbers.GraphicCell(X)
  279.    If SecondsOn Then
  280.       X = Val(Mid(Current, 7, 1))
  281.       imgNum(6).Picture = picNumbers.GraphicCell(X)
  282.       X = Val(Mid(Current, 8, 1))
  283.       imgNum(7).Picture = picNumbers.GraphicCell(X)
  284.    End If
  285.  
  286. End If
  287. If SecondsOn = 0 Then
  288.    If ColonOn Then
  289.       ColonOn = False
  290.       imgNum(2).Picture = picNumbers.GraphicCell(11)
  291.    Else
  292.       ColonOn = True
  293.       imgNum(2).Picture = picNumbers.GraphicCell(10)
  294.    End If
  295. End If
  296. End Sub
  297.  
  298.